package com.unicomcz.commision;

import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.List;

import com.unicomcz.DetailPageAction;

public class DetailWbdlAction extends DetailPageAction
{
    private String curCommId;
    private String commRemarks;
    
    
    public String getCurCommId() {
        return curCommId;
    }

    public void setCurCommId(String curCommId) {
        this.curCommId = curCommId;
    }

    public String getCommRemarks() {
        return commRemarks;
    }

    public void setCommRemarks(String commRemarks) {
        this.commRemarks = commRemarks;
    }

    @Override
    public String getSqlStr() {
        String sql="select comm_month 月份,comm_id 佣金编号,comm_name 佣金名,brand 品牌,comm_alias 别名,rule_id 规则ID,rule_name 规则名,cpmx 原因, " + 
        		"       'U'||user_no user_id,nvl(device_number,'空'）号码,depart_code,depart_id,depart_name,commmoney 佣金,remark 备注 " + 
        		"  from dls_detail_wbdr " + 
        		"where depart_code=? and comm_month=? " + 
        		"order by commmoney desc";
        return sql;
    }

    public Object[] getParams() {
        return new Object[]{userInfo.getDepartCode(),acctMonth};
    }
    protected void regQueryParam() throws Exception{
        if ((acctMonth==null)||(acctMonth.length()==0)) {
            SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM");
            acctMonth=sf.format(new java.util.Date());
        }
        log.debug(acctMonth);
        log.debug(userInfo.getUserId());
        log.debug(curCommId);
        pstmt.setString(1, userInfo.getDepartCode());
        pstmt.setString(2, acctMonth);
    }
    protected void rs2List(ResultSet rs,List out) throws Exception{
        /*
         * comm_month 月份,comm_id 佣金编号,comm_name 佣金名,brand 品牌,comm_alias 别名,rule_id 规则ID,rule_name 规则名,cpmx 原因, " + 
                "       'U'||user_no user_id,nvl(device_number,'空'）号码,depart_code,depart_id,depart_name,commmoney 佣金,remark 备注 
         */
        WbdrBean t = new WbdrBean();
        t.setAcctMonth(rs.getString(1));
        t.setCommId(rs.getString(2));
        t.setCommName(rs.getString(3));
        t.setBrand(rs.getString(4));
        t.setCommAlias(rs.getString(5));
        t.setRuleId(rs.getString(6));
        t.setRuleName(rs.getString(7));
        t.setCpmx(rs.getString(8));
        t.setUserNo(rs.getString(9));
        t.setDeviceNumber(rs.getString(10));
        t.setDepartCode(rs.getString(11));
        t.setDepartId(rs.getString(12));
        t.setDepartName(rs.getString(13));
        t.setYj(rs.getString(14));
        t.setRemark(rs.getString(15));
        out.add(t);
    }

}
